let ad=new Vue({
    el:'#information',
    data:{
        admin:JSON.parse(sessionStorage.getItem("admin"))
    },
    methods:{
        save:function(){
            let formData={
                adminId:this.admin.adminId,
                adminName:$("#adminName").val()
            }

            $.ajax({
                url:'http://localhost:8080/cinema/api/AdminUpdateServlet.do',
                type:'put',
                data:JSON.stringify(formData),
                dataType:'json',
                success:function(dto){
                    if(dto.code==200){
                        // 重新设置会话存储数据
                        let admin = {
                            adminId: ad.admin.adminId,
                            adminName: $("#adminName").val(),
                            password: ad.admin.password,
                            level: ad.admin.level,
                            image: ad.admin.image,
                            registerTime: ad.admin.registerTime,
                            status: ad.admin.status
                        }
                        sessionStorage.setItem('admin', JSON.stringify(admin));

                        layer.msg(dto.value,{icon:6});
                        
                    }else{
                        layer.msg(dto.msg,{icon:5});
                    }
                }
            });
        }
    }
});